package com.dtw.ditouwang.ui.mine;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.dtw.ditouwang.R;
import com.dtw.ditouwang.ui.BaseActivity;
import com.dtw.ditouwang.ui.login.LoginActivity;
import com.dtw.ditouwang.utils.SharedPreferencesUtil;

public class SettingActivity extends BaseActivity implements View.OnClickListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        enableBack();
        setTitle("软件设置");
        findViewById(R.id.text_bind_account).setOnClickListener(this);
        findViewById(R.id.text_help).setOnClickListener(this);
        findViewById(R.id.text_about).setOnClickListener(this);
        findViewById(R.id.button_logout).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.text_bind_account:
                startActivity(new Intent(this,BindAccountActivity.class));
                break;
            case R.id.text_help:
                startActivity(new Intent(this,HelpActivty.class));
                break;
            case R.id.text_about:
                startActivity(new Intent(this,AboutActivity.class));
                break;
            case R.id.button_logout:
                sharedPreferencesUtil.setUserName(null);
                sharedPreferencesUtil.setUserPassword(null);
                sharedPreferencesUtil.setLoginType(SharedPreferencesUtil.LoginType.Null);
                Intent intent = new Intent(this, LoginActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                break;

        }
    }
}
